package logicaBBDD;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

import logicaBeans.FarmacosBeans;
import logicaBeans.FarmacosBeans;

import com.mysql.jdbc.Statement;
public class SqlFarmacos {







	String sql=null;
public ArrayList<FarmacosBeans> arrFarmacos(Connection conexion ) throws SQLException{
	
	
	ArrayList<FarmacosBeans> lista= new ArrayList<FarmacosBeans>();
	
	sql="SELECT idFarmaco," +
			"    descripcionFarmaco," +
			"    descripcionPoblacion," +
			"    pesomolecular," +
			"    unidadConcentracionFarmaco," +
			"    minimumTrough," +
			"    maximunTrough," +
			"    minimunPeak," +
			"    maximunPeak," +
			"    unidadesDosisDiarias," +
			"    maximoDosisDiarias," +
			"    tiempoMuestreoMaximo," +
			"    mostrarIntervalosConfianza," +
			"    maxDrugconcentrationGraphed," +
			"    defaulModel," +
			"    adiposeFactor," +
			"    creatinineClearanceFormula " +
			"FROM farmacos";
	//sql="select * from farmacos";
	try {
		PreparedStatement pr_stFarmaco=conexion.prepareStatement(sql);
		
		ResultSet rsFarmaco=pr_stFarmaco.executeQuery();
		
		while (rsFarmaco.next()){
			FarmacosBeans beanFarmaco= new FarmacosBeans();
			beanFarmaco.setIdFarmaco(rsFarmaco.getInt("idFarmaco"));
		    beanFarmaco.setDescripcionFarmaco(rsFarmaco.getString("descripcionFarmaco"));
		    beanFarmaco.setDescripcionPoblacion(rsFarmaco.getString("descripcionPoblacion")) ;
		    beanFarmaco.setPesomolecular(rsFarmaco.getFloat("pesomolecular"));
		    beanFarmaco.setUnidadConcentracionFarmaco(rsFarmaco.getInt("unidadConcentracionFarmaco"));
		    beanFarmaco.setMinimumTrough(rsFarmaco.getFloat("minimumTrough"));
		    beanFarmaco.setMaximunTrough(rsFarmaco.getFloat("maximunTrough"));
		    beanFarmaco.setMinimunPeak(rsFarmaco.getFloat("minimunPeak"));
		    beanFarmaco.setMaximunPeak(rsFarmaco.getFloat("maximunPeak"));
		    beanFarmaco.setUnidadesDosisDiarias(rsFarmaco.getString("unidadesDosisDiarias"));
		    beanFarmaco.setMaximoDosisDiarias(rsFarmaco.getInt("maximoDosisDiarias"));
		    beanFarmaco.setTiempoMuestreoMaximo(rsFarmaco.getInt("tiempoMuestreoMaximo"));
		    beanFarmaco.setMostrarIntervalosConfianza(rsFarmaco.getString("mostrarIntervalosConfianza"));
		    beanFarmaco.setMaxDrugconcentrationGraphed(rsFarmaco.getInt("maxDrugconcentrationGraphed"));
		    beanFarmaco.setDefaulModel(rsFarmaco.getString("defaulModel"));
		    beanFarmaco.setAdiposeFactor(rsFarmaco.getString("adiposeFactor"));
		    beanFarmaco.setCreatinineClearanceFormula(rsFarmaco.getString("creatinineClearanceFormula"));
		
			lista.add(beanFarmaco);
		}
		
	} catch (SQLException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
		conexion.close();
		
	}
	
	
	return lista;
}
}
